<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('流程设计-ssh')" />
	<style>
		.divcss5-d{margin-bottom:3px}
	</style>
</head>

<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-ssh-add" th:data-node="${nodeId}">
		<div class="form-group divcss5-d">
			<label class="col-sm-3 control-label">主机：</label>
			<div class="col-sm-8">
				<input type="text" value=""class="form-control" name="host" />
			</div>
		</div>
		<div class="form-group divcss5-d">
			<label class="col-sm-3 control-label">shell命令：</label>
			<div class="col-sm-8">
				<textarea class="form-control" name="command" rows="3"></textarea>
			</div>
		</div>
		<div class="form-group divcss5-d">
			<label class="col-sm-3 control-label">自定义参数：</label>
			<div class="col-sm-8">
				<textarea class="form-control" name="args" rows="3"></textarea>
			</div>
		</div>
		<div class="ibox-content">
			<div class="panel-group" id="accordion">
				<div class="panel panel-default">
					<div class="panel-heading">
						<h5 class="panel-title">
							<a onclick="changeIco()" data-toggle="collapse" data-parent="#accordion" href="tabs_panels.html#collapseOne"><i class="ace-icon fa fa-chevron-right forwardCard"> </i>&nbsp;高级配置</a>
						</h5>
					</div>
					<div id="collapseOne" class="panel-collapse collapse">
						<div class="form-group divcss5-d">
							<label class="col-sm-3 control-label">预先删除路径：</label>
							<div class="col-sm-8">
								<textarea class="form-control" name="delete" placeholder='多条内容请用";"隔开' rows="3"></textarea>
							</div>
						</div>
						<div class="form-group divcss5-d">
							<label class="col-sm-3 control-label">预先创建路径：</label>
							<div class="col-sm-8">
								<textarea class="form-control" name="mkdir" placeholder='多条内容请用";"隔开' rows="3"></textarea>
							</div>
						</div>
						<div class="form-group divcss5-d">
							<label class="col-sm-3 control-label">是否捕获参数：</label>
							<div class="col-sm-8">
								<select class="form-control" name="capture-output">
									<option value="Y">是</option>
									<option value="N">否</option>
								</select>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group divcss5-d">
			<label class="col-sm-3 control-label">使用队列：</label>
			<div class="col-sm-8">
				<input id="queue" readonly="readonly" type="text" value="" class="form-control" name="queue" />
			</div>
		</div>
	</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" th:src="@{/js/design/action.js}"></script>
<script type="text/javascript">
    var formId = 'form-ssh-add';
    var nodeid=$("#"+formId).attr("data-node");
    $(document).ready(function(e) {
        var ele = parent.allscene.childs;
        for (var i = 0; i < ele.length; i++) {
            if (ele[i].elementType == 'node') {
                // alert(ele[i].nodeid + ">>>>" + nodeid);
                if (ele[i].nodeid == nodeid) {
                    subObj(ele[i],formId);
                }
            }
        }

        $("#"+formId).validate({
            rules:{
                host:{
                    required:true
                },
                command:{
                    required:true
                },
                args:{
                    required:true
                }
            },
            focusCleanup: true
        });

        var queue = parent.jobQueue;
        $("#queue").val(queue);
    });

    function submitHandler() {
        if ($.validate.form()) {
            parent.htmltojson($("#"+formId));
            $.modal.close();
        }
    }
</script>
</body>